package cn.edu.xmu.restfuldemo.model.VO;

import cn.edu.xmu.restfuldemo.model.BO.OrderItem;
import cn.edu.xmu.restfuldemo.model.PO.OrderItemPo;
import cn.edu.xmu.restfuldemo.model.VoObject;
import lombok.*;

import java.time.LocalDateTime;

/**
 * @author RenJieZheng
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class OrderItemRetVo implements VoObject {
    private Long orderId;
    private Long skuId;
    private Integer quantity;
    private Long price;
    private Long discount;
    private String name;
    private Long couponActId;
    private Long beShareId;

    public OrderItemRetVo(OrderItem orderItem){
        this.orderId = orderItem.getOrderId();
        this.skuId = orderItem.getGoodsSkuId();
        this.quantity = orderItem.getQuantity();
        this.price = orderItem.getPrice();
        this.discount = orderItem.getDiscount();
        this.name = orderItem.getName();
        this.couponActId = orderItem.getCouponActivityId();
        this.beShareId = orderItem.getBeShareId();
    }

    public OrderItem newOrderItemFormRet(){
        OrderItem orderItem = new OrderItem();
        orderItem.setOrderId(this.orderId);
        orderItem.setGoodsSkuId(this.skuId);
        orderItem.setQuantity(this.quantity);
        orderItem.setPrice(this.price);
        orderItem.setDiscount(this.discount);
        orderItem.setName(this.name);
        orderItem.setBeShareId(this.beShareId);
        orderItem.setCouponActivityId(this.couponActId);
        return orderItem;
    }

    @Override
    public Object createVo() {
        return this;
    }

    @Override
    public Object createSimpleVo() {
        return this;
    }
}
